# -*- mode: snippet -*-
# name: gen_server
# key: gen_servert
# --
%% @doc
-module(${1:`(file-name-nondirectory
               (file-name-sans-extension
                 (or (buffer-file-name) (buffer-name))))`}).
-behaviour(gen_server).

%% Interface exports
-export([start_link/0]).
-export([stop/1]).

%% Callback exports
-export([init/1]).
-export([handle_call/3]).
-export([handle_cast/2]).
-export([handle_info/2]).
-export([code_change/3]).
-export([terminate/2]).

%% Records
-record(state, {}).

%%==============================================================================
%% Interface exports
%%==============================================================================

start_link() ->
    gen_server:start_link(?MODULE, no_args, []).

stop(Pid) ->
    gen_server:cast(Pid, stop).

%%==============================================================================
%% Callback exports
%%==============================================================================

init(no_args) ->
    {ok, #state{}}.

handle_call(_Request, _From, State) ->
    {reply, ok, State}.

handle_cast(stop, State) ->
    {stop, normal, State};
handle_cast(_Request, State) ->
    {noreply, State}.

handle_info(_Info, State) ->
    {noreply, State}.

code_change(_OldVsn, State, _Extra) ->
    {ok, State}.

terminate(_Reason, _State) ->
    ok.

%%==============================================================================
%% Internal functions
%%==============================================================================


